1. Field of the Invention
The present invention relates in general to a PLC communication system, and more particularly to a parameter setting method for the PLC communication system which is capable of setting efficient parameters when a plurality of PLCs exchange rapid data through a single communication network, to enhance an efficiency of the PLC communication system.
2. Description of the Prior Art
Generally, a PLC communication system comprises a plurality of communication stations connected to a single communication network. Each of the communication stations comprises a PLC for exchanging rapid data through the single communication network. Each communication station sets parameters suitably to the other stations for data transmission and reception. Whenever a user's program is completed, each communication station performs the data transmission and reception with the other stations according to the set parameters. In this connection, the PLC communication system has mainly been used in applications such as high-speed data communication, cooperative work between the PLCs, monitoring, control and etc.
Referring to FIG. 1, there is shown a block diagram illustrating a construction of a conventional PLC communication system. As shown in this drawing, the conventional PLC communication system comprises n communication stations connected to a single communication cable to exchange data among them.
Referring to FIG. 2, there is shown a block diagram illustrating a construction of each of the n communication stations in FIG. 1. As shown in this drawing, each communication station comprises a PLC 100 for executing a user's program, a random access memory (referred to hereinafter as RAM) 200 for inputting and outputting data from/to the PLC 100, and a link controller 300 for inputting and outputting data from/to the RAM 200. The link controller 300 discriminates transmission and reception modes and performs a communication control operation in accordance with the discriminated modes.
Each communication station further comprises a transmitting data storage unit 400 for storing temporarily transmitting data of a self-station in the transmission mode, a received data storage unit 500 for storing temporarily data received from the other stations in the reception mode, and a data transmission/reception unit 600 for transmitting the self-station transmitting data from the transmitting data storage unit 400 to the other stations through the communication cable and storing the data from the other stations received through the communication cable into the received data storage unit 500.
FIG. 3 is a view illustrating a format of each of conventional parameters. As shown in this drawing, each parameter includes a station identification number Station-id, a data pointer Data-Pointer and a data number Data-Number. The station identification number Station-id designates a self-station identification number in the transmission mode or a counterpart station identification number in the reception mode. The data pointer Data-Pointer designates an address of the RAM 200 from which the transmitting data is to be read in the transmission mode or into Data-Number designates the byte number of the transmitting data in the transmission mode or the byte number of the received data in the reception mode. The parameters have the same format and are n in number which is equal to the maximum number of connectable communication stations. The n parameters are stored in a memory of the link controller 300.
The operation of the conventional PLC communication system with the above-mentioned construction and a conventional parameter setting method therefor will hereinafter be described in detail.
First, the user's program is executed in the PLC 100 of the self-station to set the parameters suitably to the other stations for the data transmission and reception. In the case where the transmission mode is set by the self-station to transmit data, the station identification number Station-id of the transmission parameter x is set to the self-station identification number. Also, the data pointer Data-Pointer of the transmission parameter x is set to the address of the RAM 200 from which the transmitting data is to be read. Further, the data number Data-Number of the transmission parameter x is set to the byte number of the transmitting data.
On the contrary, in the case where the reception mode is set by the self-station to receive data, the station identification number Station-id of the reception parameter x is set to the counterpart station identification number. Also, the data pointer Data-Pointer of the reception parameter x is set to the address of the RAM 200 from which the received data is to be written. Further, the data number Data-Number of the reception parameter x is set to the byte number of the received data. Here, the counterparts or the other stations are n-1 in number, except the self-station. A maximum length of data which can be transmitted at a time is limited to m bytes.
With one transmission parameter and n-1 reception parameters set as mentioned above, the link controller 300 checks errors of the set parameters. Whenever the user's program is completed in the PLC 100, the link controller 300 performs the data transmission and reception operations, as will hereinafter be described with reference to FIG. 8 which is a flowchart illustrating a conventional communication program.
When the user's program is completed, the PLC 100 transfers a program end signal scan-end to the link controller 300 through the RAM 200. Upon receiving the program end signal scan-end from the PLC 100 at the step 1, the link controller 300 reads sequentially the set first to nth parameters at the step 2 and compares the station identification numbers Station-id of the read parameters with the self-station identification number at the step 3. If each of the station identification numbers Station-id of the read parameters is the same as the self-station identification number at the step 3, the link controller 300 performs the data transmission operation. On the contrary, the link controller 300 performs the data reception operation if each of the station identification numbers Station-id of the read parameters is not the same as the self-station identification number at the step 3.
In the transmission mode, the link controller 300 sets a data source to the address of the RAM 200 designated by the data pointer Data-Pointer of the transmission parameter x, at the step 4. Also at the step 4, the link controller 300 sets a destination to a location of the transmitting data storage unit 400. Further at the step 4, the link controller 300 sets the number of data bytes to the data number Data-Number of the transmission parameter x. Then, the link controller 300 transfers data from the data source to the destination by the set number of bytes at the step 5. It is checked at the step 6 whether the transmission parameter x is the last one. If it is checked at the step 6 that the transmission parameter x is the last one, the link controller 300 completes the data transmission operation at the step 12. On the contrary, if the transmission parameter x is not the last one at the step 6, the link controller 300 increments the transmission parameter x by one at the step 7 to read the subsequent parameter at the step 2.
Subsequently, the data transmission/reception unit 600 reads the data stored in the transmitting data storage unit 400 and transmits the read data to the other stations through the communication cable. At this time, the transmitting data has a frame format as shown in FIG. 4A. As shown in this drawing, the transmitting data includes the station identification number of the transmitting station appended in its header and has the maximum length of m bytes.
The transmitted data from the transmitting station is received simultaneously by all the other stations. The data transmission/reception unit 600 stores the received data into the received data storage unit 500 only when the station identification number of the received data is the same as that of the reception parameter.
In the reception mode, if the station identification number of the data stored in the received data storage unit 500 is the same as that of the reception parameter x, the link controller 300 sets a data source to a location of the received data storage unit 500 in which the received data is stored, at the step 8. Also at the step 8, the link controller 300 sets a destination to the address of the RAM 200 designated by the data pointer Data-Pointer of the reception parameter x. Further at the step 8, the link controller 300 sets the number of bytes to the data number Data-Number of the reception parameter x. Then, the link controller 300 transfers the received data from the data source to the destination by the set number of bytes at the step 9. As a result, the received data is sent to the PLC 100. It is checked at the step 10 whether the reception parameter x is the last one. If it is checked at the step 10 that the reception parameter x is the last one, the link controller 300 completes the data reception operation at the step 12. On the contrary, if the reception parameter x is not the last one at the step 10, the link controller 300 increments the reception parameter x by one at the step 11 to read the subsequent parameter at the step 2.
The above-mentioned data transmission and reception operations will hereinafter be described in more detail with reference to FIGS. 5A to 7C.
It is first assumed that first to third communication stations are connected to a single communication cable as shown in FIG. 5A, which have parameters x set as shown in FIGS. 5B to 5D, respectively.
The first communication station transmits data of 100 bytes beginning with the address 100 of the RAM 200 on the basis of the set first parameter. The first communication station also stores data received from the second communication station by 50 bytes beginning with the address 400 of the RAM 200 on the basis of the set second parameter. Then, the first communication station does not perform the data reception operation according to the third parameter because no station identification number is designated.
The second communication station transmits data of 100 bytes beginning with the address 300 of the RAM 200 on the basis of the set first parameter. The second communication station also stores data received from the first communication station by 50 bytes beginning with the address 200 of the RAM 200 on the basis of the set second parameter. Then, the second communication station does not perform the data reception operation according to the third parameter because no station identification number is designated.
The third communication station does not perform the data transmission operation according to the first parameter because no station identification number is designated. The third communication station stores data received from the first communication station by 50 bytes beginning with the address 300 of the RAM 200. The third communication station also stores data received from the second communication station by 100 bytes beginning with the address 500 of the RAM 200 on the basis of the set third parameter.
In detail, in the case of reading the first parameter (x-1), the link controller 300 of the first communication station determines the transmission mode because the station identification number Station-id of the read first parameter is the same as the self-station identification number #1. In this case, the link controller 300 produces the transmitting data as shown in FIG. 7A by adding the self-station identification number #1 to the data of 100 bytes beginning with the address 100 of the RAM 200 designated by the data pointer Data-Pointer of the first parameter. Then, the link controller 300 stores the transmitting data into the transmitting data storage unit 400. The data transmission/reception unit 600 transmits the stored data from the transmitting data storage unit 400 simultaneously to the other stations through the communication cable.
In the case of reading the second parameter (x=2), the link controller 300 of the first communication station determines the reception mode because the station identification number Station-id of the read second parameter is not the same as the self-station identification number #1. In this case, the link controller 300 stores the data transmitted from the second communication station as shown in FIG. 7B by 50 bytes beginning with the address 400 of the RAM 200 designated by the data pointer Data-Pointer of the second parameter.
Upon reading the third parameter (x=3), the link controller 300 of the first communication station does not perform the data reception operation because no station identification number is designated. Then, the link controller 300 discriminates whether the read third parameter is the last one. Since the third parameter is the last one, the link controller 300 completes the data reception operation.
In the case of reading the first parameter (x-1), the link controller 300 of the second communication station determines the transmission mode because the station identification number Station-id of the read first parameter is the same as the self-station identification number #2. In this case, the link controller 300 produces the transmitting data as shown in FIG. 7B by adding the self-station identification number #2 to the data of 100 bytes beginning with the address 300 of the RAM 200 designated by the data pointer Data-Pointer of the first parameter. Then, the link controller 300 stores the transmitting data into the transmitting data storage unit 400. The data transmission/reception unit 600 transmits the stored data from the transmitting data storage unit 400 simultaneously to the other stations through the communication cable.
In the case of reading the second parameter (x=2), the link controller 300 of the second communication station determines the reception mode because the station identification number Station-id of the read second parameter is not the same as the self-station identification number #2. In this case, the link controller 300 stores the data transmitted from the first communication station as shown in FIG. 7A by 50 bytes beginning with the address 200 of the RAM 200 designated by the data pointer Data-Pointer of the second parameter.
Upon reading the third parameter (x=3), the link controller 300 of the second communication station does not perform the data reception operation because no station identification number is designated. Then, the link controller 300 discriminates whether the read third parameter is the last one. Since the third parameter is the last one, the link controller 300 completes the data reception operation.
When reading the first parameter (x=1), the link controller 300 of the third communication station does not perform the data transmission operation because no station identification number is designated.
In the case of reading the second parameter (x=2), the link controller 300 of the third communication station determines the reception mode because the station identification number Station-id of the read second parameter is not the same as the self-station identification number #3. In this case, the link controller 300 stores the data transmitted from the first communication station as shown in FIG. 7A by 50 bytes beginning with the address 300 of the RAM 200 designated by the data pointer Data-Pointer of the second parameter.
Upon reading the third parameter (x=3), the link controller 300 of the third communication station determines the reception mode because the station identification number Station-id of the read third parameter is not the same as the self-station identification number #3. In this case, the link controller 300 stores the data transmitted from the second communication station as shown in FIG. 7B by 100 bytes beginning with the address 500 of the RAM 200 designated by the data pointer Data-Pointer of the third parameter. Then, the link controller 300 discriminates whether the third parameter is the last one. Since the third parameter is the last one, the link controller 300 completes the data reception operation.
FIG. 6 is a view illustrating the flow of the transmitting and received data as mentioned above.
In the above manner, the communication stations connected to the single communication cable read sequentially the set parameters and perform the data transmission or reception operation in accordance with the read result to exchange the data among them.
However, in the case where various data such as, for example, the data of the addresses 300 and 500 as well as the address 100 of the RAM 200 are transmitted by the first communication station under the condition that the parameters are set as shown in FIGS. 5B to 5D, they cannot be distinguished from one another by the second and third communication stations. For this reason, only one transmission parameter must be set, resulting in a frame of data transmittable in one communication station being limited to 100 bytes at the maximum. Also, it is impossible to designate only a desired portion of the received data because the received data is stored from the beginning. As a result, in the case where data as shown in FIG. 7C is received, a desired portion thereof must be stored together with an unnecessary portion thereof.
As mentioned above, the conventional parameter setting method sets only one of the n parameters to the transmission parameter. For this reason, a maximum length of data which can be transmitted at a time is limited to m bytes, thereby making large scale data transmission impossible. Also, in the reception mode, the receiving station stores the received data from the beginning by the byte number set by the self-station parameter, thereby causing a desired portion of the received data to be stored together with an unnecessary portion thereof. In this connection, a communication efficiency is degraded due to losses in memory capacity and data transfer time.